package top.superflow.service.view.dto

import top.superflow.service.view.dto.ActionType.ActionType

import scala.beans.BeanProperty

class ActionDef (inputId: String, inputName: String) {

  def this() ={
    this(null,null)
  }

  @BeanProperty
  var actionId : String = inputId

  @BeanProperty
  var name : String = inputName

  @BeanProperty
  var actionType : ActionType = _

  @BeanProperty
  var subActions : Array[ActionDef] = _

  @BeanProperty
  var actionParam : ActionParam = _

  @BeanProperty
  var actionDataSource : ActionDataSource = _
}


object ActionDef {

  final val PREDEFINED_COLUMN_ACTION_VIEW_IN_PROPERTY = new ActionDef("viewProperty", "In Property")

  final val PREDEFINED_COLUMN_ACTION_VIEW_IN_JSON = new ActionDef("viewJson", "In Json")

  final val PREDEFINED_COLUMN_ACTION_VIEW = new ActionDef("viewGroup", "View")
  PREDEFINED_COLUMN_ACTION_VIEW.setSubActions(Array(PREDEFINED_COLUMN_ACTION_VIEW_IN_PROPERTY,PREDEFINED_COLUMN_ACTION_VIEW_IN_JSON))


  final val PREDEFINED_COLUMN_ACTION_UPDATE_IN_PROPERTY = new ActionDef("updateProperty","In Property")

  final val PREDEFINED_COLUMN_ACTION_UPDATE_IN_JSON = new ActionDef("updateJson","In Json")


  final val PREDEFINED_COLUMN_ACTION_UPDATE = new ActionDef("updateGroup","Update")
  PREDEFINED_COLUMN_ACTION_UPDATE.setSubActions(Array(PREDEFINED_COLUMN_ACTION_UPDATE_IN_PROPERTY,PREDEFINED_COLUMN_ACTION_UPDATE_IN_JSON))

  final val PREDEFINED_COLUMN_ACTION_DELETE = new ActionDef("delete", "Delete")
}
